<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

/**
 * App\IdentityCard
 *
 * @property int $id
 * @property string $city
 * @property int $user_id
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property-read \App\User $user
 * @method static \Illuminate\Database\Eloquent\Builder|IdentityCard newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|IdentityCard newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|IdentityCard query()
 * @method static \Illuminate\Database\Eloquent\Builder|IdentityCard whereCity($value)
 * @method static \Illuminate\Database\Eloquent\Builder|IdentityCard whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|IdentityCard whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|IdentityCard whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|IdentityCard whereUserId($value)
 * @mixin \Eloquent
 */
class IdentityCard extends Model
{
    //

    /**
     * 用户1
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function user1()
    {

//        return $this->belongsTo(User::class);
        return $this->hasOne(User::class, 'id', 'user_id');
    }

    /**  用户1
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function user2()
    {

//        return $this->belongsTo(User::class);
        return $this->hasOne(User::class, 'id', 'user_id');
    }

    /**  用户3
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function user3()
    {

//        return $this->belongsTo(User::class);
        return $this->hasOne(User::class, 'id', 'user_id');
    }


}
